<template>
  <div class="development-index">
    <!-- 顶部导航栏 -->
    <div class="top-navbar">
      <div class="navbar-content">
        <div class="logo-section">
          <img src="@/assets/img/logo.svg" alt="Logo" class="logo" />
          <span class="system-title">{{ $t('assets.development.title') }}</span>
        </div>
        <div class="dev-badge">{{ $t('assets.development.devMode') }}</div>
      </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
      <div class="content-container">
        <div class="welcome-section">
          <h1 class="page-title">{{ $t('assets.development.systemSelection') }}</h1>
          <p class="page-subtitle">{{ $t('assets.development.selectSystem') }}</p>
        </div>

        <div class="system-cards">
          <div class="system-card teacher-card" @click="goToTeacher">
            <div class="card-header">
              <div class="card-icon">👨‍🏫</div>
              <h3 class="card-title">{{ $t('assets.development.teacherSystem') }}</h3>
            </div>
            <p class="card-description">{{ $t('assets.development.teacherDescription') }}</p>
            <div class="card-footer">
              <button class="enter-button teacher-btn">{{ $t('assets.development.enterSystem') }}</button>
            </div>
          </div>

          <div class="system-card student-card" @click="goToStudent">
            <div class="card-header">
              <div class="card-icon">👨‍🎓</div>
              <h3 class="card-title">{{ $t('assets.development.studentSystem') }}</h3>
            </div>
            <p class="card-description">{{ $t('assets.development.studentDescription') }}</p>
            <div class="card-footer">
              <button class="enter-button student-btn">{{ $t('assets.development.enterSystem') }}</button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { t as $t } from '@/plugins/i18nPlugin'

const router = useRouter()
const authStore = useAuthStore()

const goToTeacher = () => {
  // 设置开发用户为教师角色
  authStore.setDevelopmentUser('teacher')
  // 导航到教师页面
  router.push('/teacher')
}

const goToStudent = () => {
  // 设置开发用户为学生角色
  authStore.setDevelopmentUser('student')
  // 导航到学生页面
  router.push('/student')
}
</script>

<style scoped>
.development-index {
  min-height: 100vh;
  background: var(--bg-color-secondary, #f8f9fa);
  display: flex;
  flex-direction: column;
}

/* 顶部导航栏 */
.top-navbar {
  background: var(--navbar-bg-color, #ffffff);
  border-bottom: 1px solid var(--border-color-secondary, #e4e7ed);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px var(--shadow-color-light, rgba(0, 0, 0, 0.05));
}

.navbar-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 32px;
  width: auto;
}

.system-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color-primary, #303133);
}

.dev-badge {
  background: #f56c6c;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* 主内容区域 */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.content-container {
  max-width: 800px;
  width: 100%;
}

.welcome-section {
  text-align: center;
  margin-bottom: 48px;
}

.page-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-color-primary, #303133);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-color-secondary, #606266);
}

/* 系统卡片 */
.system-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.system-card {
  background: var(--bg-color-primary, #ffffff);
  border: 1px solid var(--border-color-secondary, #e4e7ed);
  border-radius: 8px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow-color-light, rgba(0, 0, 0, 0.05));
  display: flex;
  flex-direction: column;
  height: 200px;
}

.system-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow-color, rgba(0, 0, 0, 0.1));
  border-color: var(--el-color-primary, #409eff);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.card-icon {
  font-size: 32px;
  line-height: 1;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color-primary, #303133);
  margin: 0;
}

.card-description {
  color: var(--text-color-secondary, #606266);
  line-height: 1.6;
  margin-bottom: 24px;
  flex: 1;
}

.card-footer {
  margin-top: auto;
}

.enter-button {
  width: 100%;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.teacher-btn {
  background: var(--el-color-primary, #409eff);
  color: white;
}

.teacher-btn:hover {
  background: #337ecc;
}

.student-btn {
  background: #67c23a;
  color: white;
}

.student-btn:hover {
  background: #529b2e;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    padding: 24px 16px;
  }

  .page-title {
    font-size: 24px;
  }

  .system-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .system-card {
    padding: 20px;
    height: auto;
  }

  .navbar-content {
    padding: 0 16px;
  }
}
</style>
